﻿using System;
using System.Collections.Generic;
using System.Text;

namespace efcoredemo.Entity
{

    public class Dept
    {
        private Dept() { }
        /// <summary>
        /// 单独添加部门
        /// </summary>
        /// <param name="name"></param>
        /// <param name="parentId"></param>
        public Dept(string name, long? parentId)
        {
            Name = name;
            ParentId = parentId;
        }
        /// <summary>
        /// 添加部门并添加用户
        /// </summary>
        /// <param name="name"></param>
        /// <param name="parentId"></param>
        /// <param name="UserDepts"></param>
        public Dept(string name, long? parentId, ICollection<UserDept> userDepts)
        {
            Name = name;
            ParentId = parentId;
            UserDepts = userDepts;
        }
        public long Id { get; private set; }
        public string Name { get; private set; }
        public long? ParentId { get; private set; }
        public virtual Dept Parent { get; private set; }
        public virtual ICollection<Dept> Depts { get; private set; }
        public virtual ICollection<UserDept> UserDepts { get; private set; }
    }

}
